<style type="text/css">
.main_column {
	margin-right: 20px;
}

</style>

<div class="box">
	<div class="header">
		<div style="float: left;">
		Đơn hàng
		</div>
		<div style="float: right; margin-top: 0px; height: 10px;font-size: 15px;">
			<table border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td><span style="background: #FEFBC4; height: 16px; width: 16px;display: block;"></span></td>
					<td><span>Chưa xác nhận</span></td>
					<td><span style="background: #A8F6C7; height: 16px; width: 16px;display: block;"></span></td>
					<td><span>Đã xác nhận</span></td>
					<td><span style="background: #E7EFF4; height: 16px; width: 16px;display: block;"></span></td>
					<td><span>Đang giao hàng</span></td>
					<td><span style="background: #81C5E7; height: 16px; width: 16px;display: block;"></span></td>
					<td><span>Hoàn tất</span></td>
					<td><span style="background: #FCCACA; height: 16px; width: 16px;display: block;"></span></td>
					<td><span>Đã hủy</span></td>
				</tr>
			</table>		
		</div>
	</div>
	<div class="body">
		<div class="panes">
			<div>
				<table border="0" cellpadding="0" cellspacing="0" class="grid_table wf">
					<thead>
						<tr>
							<th width="10">ID</th>
							<th width="">Thành viên</th>
							<th width="">Ngày đặt</th>
                            <th width="">Số lượng</th>
							<th>Thành tiền</th>
							<th>Thanh toán</th>
							<th>Tình trạng</th>
							<th>Phương thức</th>
							<th>Loại</th>
							<th>Thông tin người nhận</th>
							<th>Thông tin người gửi</th>
							<th>Ghi chú</th>
							<th align="center">Action</th>
						</tr>
					</thead>
					<tbody>
						<{foreach name=pageList item=item from=$itemList}>
						<tr class="order_<{$item.order_status}>">
							<td><{$item.deal_order_id}></td>
							<td><{$item.user_id}></td>
							<td><{$item.order_date}></td>
							<td><{$item.quantity}></td>
							<td><{$item.total_price|number_format}></td>
							<td style="color: #F16D2C"><{$dealOrderEntity->getStatusName($item.payment_status)}></td>
							<td style="color: #0095DA;"><{$dealOrderEntity->getOrderStatusName($item.order_status)}></td>
							<td><{$dealOrderEntity->getPaymentMethodName($item.payment_method)}></td>
							<td><{if $item.type=='gift'}>Quà tặng<{/if}></td>
							<td><a href="javascript:void(0);" title="Địa chỉ: <{$item.recipient_number}> - Đường <{$item.recipient_street}> - Phường <{$item.recipient_ward_ngo}> - Quận <{$item.recipient_district}>">
							<{$item.recipient_name}></a></td>
							<td><{$item.sender_name}></td>
							<td><{$item.note}></td>
							<td valign="middle">
								<{if ($item.order_status == 'notconfirm' && $item.payment_method=='Invoice') || ($item.payment_method!='Invoice' && $item.order_status == 'notconfirm' && $item.payment_status == 'completed')}>
									<a class="xacnhan_url" href="<{$APPLICATION_URL}>/Admin/DealOrder/confirm/id/<{$item.deal_order_id}>" id="xacnhan_url_<{$item.deal_order_id}>" rel="<{$item.deal_order_id}>">Xác nhận</a>
								<{elseif $item.order_status == 'confirmed' && $item.deal_status==2}>
									<a class="xacnhan_url" href="<{$APPLICATION_URL}>/Admin/DealOrder/shipping/id/<{$item.deal_order_id}>" id="xacnhan_url_<{$item.deal_order_id}>" rel="<{$item.deal_order_id}>">Giao hàng</a>
								<{elseif $item.order_status == 'delivery'}>
									<a class="xacnhan_url" href="<{$APPLICATION_URL}>/Admin/DealOrder/confirmShipping/id/<{$item.deal_order_id}>" id="xacnhan_url_<{$item.deal_order_id}>" rel="<{$item.deal_order_id}>">Xác nhận hóa đơn</a>	
								<{/if}>
								<{if ($item.order_status == 'notconfirm' && $item.payment_method=='Invoice') || ($item.payment_method!='Invoice' && $item.order_status == 'notconfirm' && $item.payment_status == 'pending')}>
									 <p><a class="xacnhan_url" href="<{$APPLICATION_URL}>/Admin/DealOrder/cancel/id/<{$item.deal_order_id}>">Hủy</a></p>
								<{/if}>
							</td>
						</tr>
						<{/foreach}>
					</tbody>
				</table>
			</div>			
			<div class="paging" style="text-align:center;">
			<{$pageLink}>
			</div>
		</div>
	</div>
</div>
<form name="frmDelete" method="post">
<input type="hidden" name="idValue" value="" />
<input type="hidden" id="actionKey" name="actionKey" value="<{$actionKey}>" />
</form>
<script type="text/javascript">
function deleteAction(value){
	var theform = document.frmDelete;
	theform.idValue.value = value;
	theform.action = "<{$APPLICATION_URL}>/Admin/Deals/delete";
	theform.submit();
	return true;
}


$(document).ready(function(){
	  $(".xacnhan_url").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: true,
		'onClosed'		: function() {
		},
		'onStart' : function(){
		      //load info order
		},
		'onClosed' : function(){
			//window.location.reload();	
		}
	});
		
});

</script>

<div style='display: none'>
	<div id="kichhoat_form">
		<div id="main-content">
			<div class="two-column alpha">
				<h4 class="article-title">Xác nhận</h4>
				<form action="<{$APPLICATION_URL}>/Admin/Deals/approve" method="post"
					id="approveForm" name="approveForm" class="approveForm" onsubmit="return approveDeal();">											
					<button>Xác nhận</button> hay <a href="#" onclick="$.fancybox.close();">Thoát</a>
					<input type="hidden" value="" id="fdeal_order_id" name="deal_order_id"> 
				</form>
				<div class="clear"></div>
			</div>			
		</div>
	</div>
</div>
